read to EOL for pod and container id in cgroup#21
Open
zwpaper wants to merge 2 commits intotkestack:masterfrom
Open
read to EOL for pod and container id in cgroup#21zwpaper wants to merge 2 commits intotkestack:masterfrom
zwpaper wants to merge 2 commits intotkestack:masterfrom
Conversation
fix containerd cgroupfs path use `:` Signed-off-by: ZhangWei <zhangwei@sensetime.com>
mYmNeo
reviewed
Feb 16, 2022
| for (token = strtok_r(buffer, ":", &last_ptr); token; token = strtok_r(NULL, ":", &last_ptr)) { | ||
| if (!strcmp(token, "memory")) { | ||
| cgroup_ptr = strtok_r(NULL, ":", &last_ptr); | ||
| cgroup_ptr = strtok_r(NULL, "\n", &last_ptr); |
Contributor
There was a problem hiding this comment.
fgets never return EOL character , why search for EOL?
Author
There was a problem hiding this comment.
strtok_r is used here instead of fgets you mentioned.
containerd will use : as file name separator if cgroupfs is used so that it will read a wrong pod id and container id if search to :.
mYmNeo
reviewed
Feb 16, 2022
| * /kubepods/besteffort/pod27882189_b4d9_11e9_b287_ec0d9ae89a20/docker-4aa615892ab2a014d52178bdf3da1c4a45c8ddfb5171dd6e39dc910f96693e14 | ||
| * | ||
| * containerd | ||
| * /system.slice/containerd.service/kubepods-besteffort-pod019c1fe8_0d92_4aa0_b61c_4df58bdde71c.slice:cri-containerd:9e073649debeec6d511391c9ec7627ee67ce3a3fb508b0fa0437a97f8e58ba98 |
Contributor
There was a problem hiding this comment.
Which version of kubernetes generates this cgroup pattern?
Author
There was a problem hiding this comment.
try v1.21.x with containerd and cgroupfs.
Signed-off-by: ZhangWei <zhangwei@sensetime.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix containerd cgroupfs path use
:refactor the reading logic to simplify it.